package demo1225.am;

import java.io.*;

/*
OutputStreamWriter(OutputStream out, String charsetName)
          创建使用指定字符集的 OutputStreamWriter。
 */
public class Demo_02 {
    public static void main(String[] args) {
        try (OutputStreamWriter os = new OutputStreamWriter
                (new FileOutputStream("abc.txt"),
                        "GBK")) {
            os.write("中国出口量");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
